<?xml version="1.0" encoding="utf-8"?>
<element xmlns="http://relaxng.org/ns/structure/1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml" name="library" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <oneOrMore>
    <element name="book">
      <attribute name="id">
        <data type="NMTOKEN">
          <param name="maxLength">16</param>
        </data>
      </attribute>
      <attribute name="available">
        <data type="boolean"/>
      </attribute>
      <element name="isbn">
        <data type="NMTOKEN">
          <param name="pattern">[0-9]{9}[0-9x]</param>
        </data>
      </element>
      <element name="title">
        <attribute name="xml:lang">
          <data type="language">
            <param name="length">2</param>
          </data>
        </attribute>
        <data type="token">
          <param name="maxLength">255</param>
        </data>
      </element>
      <zeroOrMore>
        <element name="author">
          <attribute name="id">
            <data type="NMTOKEN">
              <param name="maxLength">16</param>
            </data>
          </attribute>
          <element name="name">
            <data type="token">
              <param name="maxLength">255</param>
            </data>
          </element>
          <element name="born">
            <data type="date">
              <param name="minInclusive">1900-01-01</param>
              <param name="maxInclusive">2099-12-31</param>
              <param name="pattern">
							  <!-- We don't want timezones in our dates. -->
							  [0-9]{4}-[0-9]{2}-[0-9]{2}
							</param>
            </data>
          </element>
          <optional>
            <element name="dead">
              <data type="date">
                <param name="minInclusive">1900-01-01</param>
                <param name="maxInclusive">2099-12-31</param>
                <param name="pattern">[0-9]{4}-[0-9]{2}-[0-9]{2}</param>
              </data>
            </element>
          </optional>
        </element>
      </zeroOrMore>
      <zeroOrMore>
        <element name="character">
          <attribute name="id">
            <data type="NMTOKEN">
              <param name="maxLength">16</param>
            </data>
          </attribute>
          <element name="name">
            <data type="token">
              <param name="maxLength">255</param>
            </data>
          </element>
          <element name="born">
            <data type="date">
              <param name="minInclusive">1900-01-01</param>
              <param name="maxInclusive">2099-12-31</param>
              <param name="pattern">[0-9]{4}-[0-9]{2}-[0-9]{2}</param>
            </data>
          </element>
          <element name="qualification">
            <data type="token">
              <param name="maxLength">255</param>
            </data>
          </element>
        </element>
      </zeroOrMore>
    </element>
  </oneOrMore>
</element>
